<template>
    <div class="infinite-container">
        <div class="text-info center">状态：{{PAY_STATUS[orderDetail.payStatus]}}</div>

        <common-list title="就诊科室" :desc="orderDetail.regDeptName"></common-list>
        <common-list title="就诊医生" :desc="orderDetail.doctorName" v-if="orderDetail.doctorName"></common-list>
        <common-list title="就诊日期" :desc="orderDetail.workDate"></common-list>
        <common-list title="预估就诊时间" :desc="orderDetail.startTime + ' - ' + orderDetail.endTime"></common-list>
        <common-list title="就诊序号" v-show="showRegVisitingNumber">
          <div class="confirm-money">
            {{orderDetail.regVisitingNumber}}
          </div>
        </common-list>
        <common-list title="就诊地点" :desc="orderDetail.address"></common-list>
        

        <common-list title="就诊人" :desc="person.personName" margin="10"></common-list>
        <common-list title="门诊号码" :desc="orderDetail.seqId"></common-list>
        <common-list title="手机号码" :desc="orderDetail.regPhoneNo"></common-list>

        <common-list title="挂号费用" margin="10">
          <div class="confirm-money">
             ￥{{orderDetail.charge.toFixed(2)}}
          </div>
        </common-list>
        <common-list title="挂号日期" :desc="orderDetail.submitDate"></common-list>   
        
    </div>
</template>

<script>
import CommonList from '../../components/CommonList'
import {commonAjax, ORG_ID, PLATFORM_PREFIX, PAY_STATUS} from '../../api/api'

export default {
  data () {
    return {
      dialog: false,
      PAY_STATUS: PAY_STATUS,
      orderDetail: {charge: 0, startTime: 0, endTime: 0},
      person: JSON.parse(localStorage.familyPerson),
      showRegVisitingNumber: false
    }
  },
  mounted () {
    this.$store.commit('UPDATE_TITLE', '挂号单详情')
    this.$store.commit('UPDATE_LOADING')
    commonAjax(
      [ORG_ID, this.$route.query.regRecordId],
      `${PLATFORM_PREFIX}.registrationService`,
      'getRegistrationDetail'
    ).then(res => {
      this.$store.commit('UPDATE_LOADING')
      if (res.data.code === 200) {
        this.orderDetail = res.data.body
        if (this.orderDetail.payStatus === '2') {
          this.showRegVisitingNumber = true
        }
      } else {
        this.$store.commit('UPDATE_TOAST', {message: res.data.msg})
      }
    })
  },
  beforeDestroy () {
    this.$store.commit('UPDATE_TITLE')
  },
  components: {
    CommonList
  }
}
</script>

